package mfuny.ggongal.admin;

import mfuny.ggongal.admin.contents.ContentDao;
import mfuny.ggongal.admin.contents.ContentService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ContentsController {
	
	ContentService con;
	
	public ContentsController() throws Exception {
		con = new ContentService();
	}
	
	@RequestMapping("/contentsList.ga")
	public ModelAndView contentsList() throws Exception {
		return con.contentsList();
	}
	
	@RequestMapping("/regContentsForm.ga")
	public ModelAndView regContentsForm( ) throws Exception {
		return con.regContentsForm( );
	}
	
	@RequestMapping("/regContents.ga")
	public ModelAndView regContents(@ModelAttribute ContentDao conDao ) throws Exception {
		con.regContents( conDao );
		return regContentsForm();
	}
	
	@RequestMapping("/contentsList_detail.ga")
	public ModelAndView contentsList_detail(String jsonParam) throws Exception {
		return con.contentsList_detail(jsonParam);
	}
	
	@RequestMapping("/modifyContentsForm.ga")
	public ModelAndView modifyContentsForm(int no) throws Exception {
		return con.modifyContentsForm(no);
	}
	
	@RequestMapping("/modifyContents.ga")
	public ModelAndView modifyContents(@ModelAttribute ContentDao conDao) throws Exception {
		return con.modifyContents(conDao);
	}
}
